<?php
/**
 * This file defines the exception class {@see \BF\IO\Exception}
 *
 * @author     Kado <ulfikado@gmail.com>
 * @category   Beluga PHP5.3+ Framework
 * @package    BF\IO
 * @since      2015-01-31 00:29
 * @subpackage Exceptions
 * @version    0.1
 */

namespace BF\IO
{

   /**
    * This class defines a exception, used as base exception of all IO exceptions.
    *
    * It extends from {@see \BF\Exception}.
    *
    * @since v0.1
    */
   class Exception extends \BF\Exception
   {

      # <editor-fold defaultstate="collapsed" desc=" - - -   P R O T E C T E D   F I E L D S   - - - - - - - - - - - - - - - - - - - -">

      protected $path;

      # </editor-fold>

      # <editor-fold defaultstate="collapsed" desc=" - - >   P U B L I C   C O N S T R U C T O R   - - - - - - - - - - - - - - - - - -">

      /**
       * Inits a new instance.
       *
       * @param string         $path     The path, associated with the error.
       * @param string         $message  A optional error message.
       * @param integer        $code     The optional error code (Defaults to \E_USER_ERROR)
       * @param \Exception     $previous A optional previous exception
       */
      public function __construct( $path, $message = null, $code = 256, \Exception $previous = null )
      {
         parent::__construct(
            \sprintf( 'There was a error with path [%s]!', $path ) . $this->appendMessage( $message ),
            $code,
            $previous
         );
         $this->path = $path;
      }

      # </editor-fold>

      # <editor-fold defaultstate="collapsed" desc=" - - -   P U B L I C   M E T H O D S   - - - - - - - - - - - - - - - - - - - - - -">

      /**
       * Returns the path that was error depending.
       *
       * @return string
       */
      public final function getPath()
      {
          return $this->path;
      }

      # </editor-fold>

   }

}

